#ifndef _DATABASE_H_
#define _DATABASE_H_

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include "visgrabTypes.h"


//! Class to access the database.
/*!
 * The class contains functions to read the database info, to load the left and
 * right rectified images, the disparity maps, and the point clouds.
 */
class Database {
 public:
  Database() {};
  ~Database() {};
  void readScenesInfo(std::vector<SceneInfo*> &scenes, std::string xmlFile = "VisgrabSummary.xml");
  void writeDatabaseInfo(std::vector<SceneInfo*> &scenes, std::string xmlFile = "VisgrabManifest.xml");
  void readDatabaseInfo(std::vector<SceneInfo*> &scenes, std::string xmlFile = "VisgrabManifest.xml");
  SceneData* getSceneData(SceneInfo* sceneInfo, std::string rootPath);
  void addCollisionInfoDirectory(std::vector<SceneInfo*> &scenes, std::string collisionInfoPath);
 private:
  bool checkExistenceFiles(SceneInfo* sceneInfo, std::string &errorMessage);
  std::string getPoseCondition(std::vector<PoseCondition> &poseConditions, int nrObjects, int poseID);
};

#endif
